package my.dict.data;


import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import android.os.Environment;

public class Source {
	
	String stringLines;
	
	public Source(String fileName) {

		
		StringBuilder sb = new StringBuilder("");
		
		try {

			
			//File myFile = new File(fileName);

			//Find the directory for the SD Card using the API
			//*Don't* hardcode "/sdcard"
			File sdcard = Environment.getExternalStorageDirectory();

			//Get the text file
			File myFile = new File(sdcard, "wordlist.txt");
					
			
			FileReader fileReader = new FileReader(myFile);
			BufferedReader reader = new BufferedReader(fileReader);
			
			String line = null;
			while((line = reader.readLine()) != null) {
				sb.append(line + "\n");				
			}
			
			stringLines = sb.toString();
			
			//System.out.println(stringLines);
			
			reader.close();
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
		
	}
}
